<!--添加栏目-->
<div class="dialog_content col_tab">
<form id="info_form" action="{:U('Youpku/collect')}" method="post">

	<div class="J_panes">
        <div class="content_list pad_10">
	<table width="100%" class="table_form">
		<notempty name="err_msg">
			{$err_msg} <a href="{:U('Setting/index')}">前往设置->></a>
		<else />
		<tr> 
			<th width="100">入库分类 :</th>
			<td>
				<select class="J_cate_select mr10" data-pid="0" data-uri="{:U('ItemsCate/ajax_getchilds')}" data-selected="{$spid}"></select>
				<input type="hidden" name="cid" id="J_cate_id" />
			</td>
			<input type="hidden" name="id" value="{$id}" />
			<input type="hidden" name="p" id="J_page" value="1" />
		</tr>
		</notempty>
		 
	</table>
	</div>
	
	 
        </div>
	</form>
</div>
<script>
$(function(){

	var collect_url = "{:U('Youpku/collect')}";
	var id = "{$id}";
	var p = 2;
	$.formValidator.initConfig({formid:"info_form",autotip:true});
	$('#info_form').ajaxForm({success:complate, dataType:'json'});
	function complate(result){
		if(result.status == 1){
			$.dialog.get(result.dialog).close();
			$.itaoke.tip({content:result.msg});
		} else if(result.status == 2){
			//$.dialog.get(result.dialog).close();
			$.itaoke.tip({content:result.msg});
			var cid =$('#J_cate_id').val();
			collect(id,p,cid);
		}else {
			$.itaoke.tip({content:result.msg, icon:'alert'});
		}
	}
	function collect(id,p,cid){
        $.getJSON(collect_url, {id:id,p:p,cid:cid}, function(result){
            if(result.status == 1){
		$.dialog.get('collect_dialog').close();
		$.itaoke.tip({content:result.msg});
            }else{
                $.itaoke.tip({content:result.msg});
            }
        });
	}

	//分类联动
	$('.J_cate_select').cate_select();
});
</script>